﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace Magnet
{
    public class TextureManager
    {
        private static Game game;

        private static Dictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>();

        public static void Initialize(Game g)
        {
            game = g;
        }
        public static Texture2D LoadTexture(string name)
        {
            ContentManager content = game.Content;
            Texture2D texture;
            if (textures.ContainsKey(name))
            {
                return textures[name];
            }
            else
            {
                texture = content.Load<Texture2D>("Textures\\" + name);
                textures.Add(name, texture);
                return texture;
            }
        }
    }
}
